<!DOCTYPE html>
<html>
    <head>
	<meta charset="utf-8" />
		<title></title>
<!--[if lt IE 9]><!-->
    		<script src="http://code.jquery.com/jquery-1.11.3.min.js "></script>
<!--<![endif]-->
<!--[if gte IE 9]><!-->
			<script src="https://code.jquery.com/jquery-3.2.1.min.js "></script>
<!--<![endif]-->
	<script>
	$(document).ready(function(){
	$("button").click(function(){
		$("p").offsetParent().css("background-color","red");
	});
});
</script>
</head>
<body>

<button>设置背景颜色</button>
<div style="border:1px solid black;width:70%;position:absolute;left:10px;top:50px">
<div style="border:1px solid black;margin:50px;background-color:yellow">
<p>点击按钮这一段的设置第一个定位的父元素的背景颜色。</p>
</div></div>

</body>
</html>
